function kmeansTest
    close all
    
    k = 5;
    colors = char('r.', 'b.', 'y.', 'k.', 'm.', 'c.', 'g.');
    P = generatePointCloud;
    X = P(:,1);
    Y = P(:,2);
    Z = P(:,3);
    [idx,ctrs] = kmeans([X,Y,Z],k);
%     
    figure;
    hold on;
    for i = 1:k
        color = colors(mod(i-1,7)+1,:);
        plot3(X(idx==i),Y(idx==i),Z(idx==i),color,'MarkerSize',6);
    end
    plot3(ctrs(:,1),ctrs(:,2),ctrs(:,3),'kx',...
         'MarkerSize',12,'LineWidth',2)
    plot3(ctrs(:,1),ctrs(:,2),ctrs(:,3),'ko',...
         'MarkerSize',12,'LineWidth',2)
    axis equal
    set(gca,'ZDir','reverse')
end